/**
 * 
 */
package stc.skymobi.transport.protocol.esb.hdr;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import stc.skymobi.bean.esb.annotation.EsbField;
import stc.skymobi.bean.esb.core.TerminalUserAgentTLV;


/**
 * 以tlv格式来传输ua信息
 * 只选择传输用到的字段
 * @author Bluces.Wang@sky-mobi.com
 *
 */
public class ETFTerminalUserAgentTLV {
    private static final Logger logger = LoggerFactory.getLogger(ETFTerminalUserAgentTLV.class);
    
	@EsbField(tag=701,index = 1,description = "厂商")
	private String factoryCode = "";

	@EsbField(tag=702,index = 2,description = "机型")
	private String terminalCode = "";

	@EsbField(tag=703,index = 3,bytes = 4, description = "虚拟机版本")
	private long vmv;

	@EsbField(tag=704,index = 4,bytes = 4, description = "移植版本号")
	private long hsv;

	@EsbField(tag=705,index = 5,description = "终端屏幕宽度")
	private short screenSizeWidth;

	@EsbField(tag=706,index = 6,description = "终端屏幕高度")
	private short screenSizeHeight;

	@EsbField(tag=707,index = 7,description = "终端内存大小")
	private short terminalMemory;

	@EsbField(tag=708,index = 8,description = "IMEI 正确长度为15字节, 16字节为'\0', ASCII编码")
	private String imei = "";

	@EsbField(tag=709,index = 9,description = "IMSI 正确长度为15字节, 16字节为'\0', ASCII编码")
	private String imsi = "";

	@EsbField(tag=710,index = 10,bytes = 4, description = "入口 也是渠道标志")
	private long entrance;
	
	@EsbField(tag=711,index = 11,bytes = 4, description = "应用ID")
	private long appid;
	
	@EsbField(tag=712,index = 12,bytes = 2, description = "应用版本号")
	private int appver;
	
	@EsbField(tag=713,index = 13,description = "手机平台")
	private byte platform;
	
	@EsbField(tag=714,index = 14,description = "终端的网络")
	private String ipAddress;
	
	@EsbField(tag=715,index = 15, description = "渠道标志 变长字符串") 
	private String channelSymbol;
	
	@EsbField(tag=716 ,index = 16,description="终端唯一ID")
	private String terminalID;

    public String toString() {
        return  ToStringBuilder.reflectionToString(this, 
                            ToStringStyle.SHORT_PREFIX_STYLE);
    }
    
	public TerminalUserAgentTLV toTerminalUserAgentTLV() {
		TerminalUserAgentTLV ret = new TerminalUserAgentTLV();
		
		try {
			BeanUtils.copyProperties(ret, this);
		} catch (Exception e) {
			logger.error("toTerminalUserAgent:", e);
		}
		
		return	ret;
	}
	
	public static ETFTerminalUserAgentTLV fromTerminalUserAgentTLV(TerminalUserAgentTLV orig) {
		ETFTerminalUserAgentTLV ret = new ETFTerminalUserAgentTLV();
		
		try {
			BeanUtils.copyProperties(ret, orig);
		} catch (Exception e) {
			logger.error("fromTerminalUserAgent:", e);
		}
		
		return	ret;
	}

	public String getFactoryCode() {
		return factoryCode;
	}

	public void setFactoryCode(String factoryCode) {
		this.factoryCode = factoryCode;
	}

	public String getTerminalCode() {
		return terminalCode;
	}

	public void setTerminalCode(String terminalCode) {
		this.terminalCode = terminalCode;
	}

	public long getVmv() {
		return vmv;
	}

	public void setVmv(long vmv) {
		this.vmv = vmv;
	}

	public long getHsv() {
		return hsv;
	}

	public void setHsv(long hsv) {
		this.hsv = hsv;
	}

	public short getScreenSizeWidth() {
		return screenSizeWidth;
	}

	public void setScreenSizeWidth(short screenWidth) {
		this.screenSizeWidth = screenWidth;
	}

	public short getScreenSizeHeight() {
		return screenSizeHeight;
	}

	public void setScreenSizeHeight(short screenHeight) {
		this.screenSizeHeight = screenHeight;
	}

	public short getTerminalMemory() {
		return terminalMemory;
	}

	public void setTerminalMemory(short terminalMemory) {
		this.terminalMemory = terminalMemory;
	}

	public String getImei() {
		return imei;
	}

	public void setImei(String imei) {
		this.imei = imei;
	}

	public String getImsi() {
		return imsi;
	}

	public void setImsi(String imsi) {
		this.imsi = imsi;
	}

	public long getEntrance() {
		return entrance;
	}

	public void setEntrance(long entrance) {
		this.entrance = entrance;
	}

	public long getAppid() {
		return appid;
	}

	public void setAppid(long appid) {
		this.appid = appid;
	}

	public int getAppver() {
		return appver;
	}

	public void setAppver(int appver) {
		this.appver = appver;
	}

	public byte getPlatform() {
		return platform;
	}

	public void setPlatform(byte platform) {
		this.platform = platform;
	}

	public String getIpAddress() {
		return ipAddress;
	}

	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}

	public String getChannelSymbol() {
		return channelSymbol;
	}

	public void setChannelSymbol(String channelSymbol) {
		this.channelSymbol = channelSymbol;
	}

	public String getTerminalID() {
		return terminalID;
	}

	public void setTerminalID(String terminalID) {
		this.terminalID = terminalID;
	}

}
